package com.changgou.service.goods.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changgou.goods.pojo.Sku;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SkuMapper extends BaseMapper<Sku> {
    void insertSelective(Sku sku);

    @Select("select tb_sku.* from tb_spu inner join tb_sku on #{id} = tb_sku.id")
    List<Sku> selectBySpuId(@Param("id") String id);

    @Delete("delete from tb_sku where tb_sku.spuId = #{id}")
    void deleteBySpuId(@Param("id") String id);
}
